package com.region.http.client.resolver.result;

import com.region.common.utils.RandomUtils;
import com.region.http.client.config.ClientConfig;

import java.io.File;

/**
 * Parameter result parser abstract class
 *
 * @author liujieyu
 * @date 2023/6/18 19:47
 * @desciption
 */
public abstract class AbstractResultResolver implements ResultResolver {

    private ClientConfig config;

    public void setConfig(ClientConfig config) {
        this.config = config;
    }

    /**
     * Generate path of the cache random file name
     */
    protected String getCacheTmpFilePath() {
        return config.getCachePath() + File.separator + RandomUtils.getId();
    }

    /**
     * Generate path
     */
    protected String getCacheTmpFilePath(String fileName) {
        return config.getCachePath() + File.separator + fileName;
    }
}
